extends "res://tscn/map/home.gd"

func init():
	for j in range(sys.player.items.items.size()-1,-1,-1) :
		var i = sys.player.items.items[j]
		if i is Mater && i.isHomeShow:
			var mi = load("res://tscn/item/itemBtn.tscn").instance()
			$mRect/box.add_child(mi)
			mi.init(i)
	
	sys.addTip($"RtsBar/btnBox/1","部队(Z)")
	sys.addTip($"RtsBar/btnBox/2","仓库(X)")
	sys.addTip($"RtsBar/btnBox/4","神徽(C)")
	sys.addTip($"RtsBar/btnBox/3","选项(V)")
	
	var utils = sys.get_node("VEBase").utils
	utils.addShotCutToBtn($"RtsBar/btnBox/1", KEY_Z, false)
	utils.addShotCutToBtn($"RtsBar/btnBox/2", KEY_X, false)
	utils.addShotCutToBtn($"RtsBar/btnBox/4", KEY_C, false)
	utils.addShotCutToBtn($"RtsBar/btnBox/3", KEY_V, false)
	
	if sys.game.globals.has("g_game"):
		sys.addTip($hcBtn,tr("离开")+ "\n" + tr("但是时间会推进 %s") % sys.getTimeStr(sys.game.globals.g_game.hcTime))
	else:
		$hcBtn.hide()
	
	sys.game.connect("onNextTime",self,"rNextTime")
	sys.game.connect("onToMap",self,"_toMap")
	if sys.game.globals.has("g_m"):
		sys.game.globals.g_m.connect("onSetLv",self,"_setMiasmaLv")
		_setMiasmaLv()
	rNextTime()
	if sys.game.isTimeOn == false:
		$time.hide()
 
func _toMap(mapId):
	if sys.game.mode != "tower":
		$hcBtn.visible = mapId != sys.game.mainMapId
	else:
		$hcBtn.hide()
